980068b1e0e72d186af184955f184d44ce1916ce,plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/GridLayoutOperation.java,GridLayoutOperation,execute,#,38

Before Change


    RadViewComponent nextComponent = getNextComponent(components, myRow, myColumn);

    if (myInsertType == GridInsertType.in_cell) {
      if (myRow <= gridInfo.lastRow && myColumn <= gridInfo.lastColumn) {
        if (myContext.isMove()) {
          Rectangle cellInfo = RadGridLayoutComponent.getCellInfo(editComponent);
          components[cellInfo.y][cellInfo.x] = null;
          components[myRow][myColumn] = editComponent;
        }
        else {
          execute(myContext, container, myComponents, nextComponent);
          RadGridLayoutComponent.setCellIndex(editComponent, myRow, myColumn);
          return;
        }
      }
      else {
        execute(myContext, container, myComponents, null);
        RadGridLayoutComponent.setCellIndex(editComponent, myRow, myColumn);
        return;
      }
    }
    else if (myInsertType == GridInsertType.before_h_cell || myInsertType == GridInsertType.after_h_cell) {
      insertComponent(components, nextComponent, true, myInsertType == GridInsertType.after_h_cell, false, false);
    }
    else if (myInsertType == GridInsertType.before_v_cell || myInsertType == GridInsertType.after_v_cell) {
      insertComponent(components, nextComponent, false, false, true, myInsertType == GridInsertType.after_v_cell);
    }
    else {
      insertComponent(components, nextComponent,
                      true, myInsertType == GridInsertType.corner_bottom_left || myInsertType == GridInsertType.corner_bottom_right,
                      true, myInsertType == GridInsertType.corner_top_right || myInsertType == GridInsertType.corner_bottom_right);
    }

    validateLayoutParams(components);

After Change



  @Override
  public void execute() throws Exception {
    GridInfo gridInfo = getGridInfo();

    RadGridLayoutComponent container = (RadGridLayoutComponent)myContainer;
    RadComponent[][] components = container.getGridComponents(false);
    RadComponent editComponent = myComponents.get(0);

    if (myInsertType == GridInsertType.in_cell && (myRow >= gridInfo.rowCount || myColumn >= gridInfo.columnCount)) {
      execute(myContext, container, myComponents, null);
      RadGridLayoutComponent.setCellIndex(editComponent, myRow, myColumn, true);
      return;
    }

    RadViewComponent nextComponent = getNextComponent(components, myRow, myColumn);

    if (myInsertType == GridInsertType.in_cell) {
      if (!myContext.isMove()) {
        execute(myContext, container, myComponents, nextComponent);
        RadGridLayoutComponent.setCellIndex(editComponent, myRow, myColumn, true);
        return;
      }

      components = insertComponent(components, nextComponent, false, false, false, false);
    }
    else if (myInsertType == GridInsertType.before_h_cell || myInsertType == GridInsertType.after_h_cell) {
      components = insertComponent(components, nextComponent,
                                   true, myInsertType == GridInsertType.after_h_cell,
                                   false, false);
    }
    else if (myInsertType == GridInsertType.before_v_cell || myInsertType == GridInsertType.after_v_cell) {
      components = insertComponent(components, nextComponent, false, false,
                                   true, myInsertType == GridInsertType.after_v_cell);
    }
    else {
      components = insertComponent(components, nextComponent,
                                   true,
                                   myInsertType == GridInsertType.corner_bottom_left || myInsertType == GridInsertType.corner_bottom_right,
                                   true,
                                   myInsertType == GridInsertType.corner_top_right || myInsertType == GridInsertType.corner_bottom_right);
    }

    validateLayoutParams(components);